﻿CREATE PROCEDURE [dbo].[proc_Orders_Update]
	(
		@ContactPerson nvarchar(50),
		@ContactPhone nvarchar(50),
		@FixtureDate datetime,
		@Description text,
		@Aggregateamount numeric(18,2),
		@Proceeds numeric(18,2),
		@CreateDate datetime,
		@FinanceFlag bit,
		@PaymentTypeId int,
		@OId uniqueidentifier,
		@MainProjectId int,
		@UserName nvarchar(50)
	)
AS
Begin
Update Orders Set
	ContactPerson=@ContactPerson,
	ContactPhone=@ContactPhone,
	FixtureDate=@FixtureDate,
	Description=@Description,
	Aggregateamount=@Aggregateamount,
	Proceeds=@Proceeds,
	FinanceFlag=@FinanceFlag,
	MainProjectId=@MainProjectId,
	PaymentTypeId=@PaymentTypeId,
	IsReason=0
	Where OId=@OId
	
	--日志
	Declare @CustomerId uniqueidentifier,@CustoemrName nvarchar(50)
	Set @CustomerId = (Select CustomerId From Orders Where OId=@OId)
	Set @CustoemrName = (Select CustomerName From Orders Where OId=@OId)
	Insert Into Orders_EditLog (OrderId,CustomerId,CustomerName,UserName,CreateDate)
	Values(@OId,@CustomerId,@CustoemrName,@UserName,getdate())
End
	RETURN
